#ifndef CONFIG_H
#define CONFIG_H
#include <stdio.h>
#include "pcre.h"

#define ZCOPY_MAXCARD 16

#define PROTOCOL_MAX_NUM 100

#define SPIDE_FILTER_RULE_NUM 100

typedef struct  spider_filter_rule
{
	char *url_regex;
    pcre *url_re;
    
    char *host_regex;
    pcre *host_re;
    
    char *refer_regex;
    pcre *refer_re;
    
    char *userdefine_regex;
    pcre *userdefine_re;
    
	int action;
}spider_filter_rule_t;


struct dma_card_conf
{
	char name[10];
	int direct;		//0-in 1 out 2-bid
};

struct sysconfig
{
	char ppsid[PPS_MAX_ID_STR_LEN]; //id of pps
	char cfg_file_name[PPS_PATH_MAX];
	u_short udp_port;
	int  udp_fd;		//cas socket
	int  sock_fd;	   //the descriptor of raw packet for sending packet
	int debug_level;
	int debug_enable;	//globe debug switch
	int check_stamp;
	int network_card_type;
    int clientpool_direct;

    int itgasflag;
    int pkfiltflag;
    int regula_num;
    
    char serip[16];
    char serport[8];
    
	struct dma_card_conf dma_list[ZCOPY_MAXCARD];
    
    spider_filter_rule_t spider_filter_rules[SPIDE_FILTER_RULE_NUM];
    
	struct sockaddr_in report_addr;
	pthread_rwlock_t data_rwlock; //controlling g_lbe, g_ppc_tbl, g_ipscope_tbl, g_ruler_tbl and g_dma_tbl
};

extern struct sysconfig g_ppsconfig;
extern ipscope_table   g_ipscope_tbl;//contains ip addresses of monitored hosts
extern ipscope_table   g_ipscope_all_tbl;
extern struct addr_list_t g_server_addr_free_list;

#endif
